﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WarehouseManagement.ViewModels.Merchandise;
//using WarehouseManagement.DTO.Merchandise;
using WarehouseManagement.Views.Merchandise;

namespace WarehouseManagement.Views
{
    public static class MerchandiseListControlExtensions
    {
        private static void FormatGrid(this MerchandiseList control)
        {
            //control.grvMerchandise.OptionsSelection.MultiSelect = true;
            //control.grvMerchandise.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
        }

        public static void LoadGridViewData(this MerchandiseList control)
        {
            control.Presenter.LoadMerchandiseList();
            FormatGrid(control);
        }

        //public static void HandleControlsState(this MerchandiseListControl control, IEnumerable<MerchandiseDTO> data)
        //{
        //    control.btnEdit.Enabled = (data.Count() == 1);
        //    control.btnDelete.Enabled = (data.Count() > 0);
        //}

        //public static IEnumerable<MerchandiseDTO> GetSelectedMerchandises(this MerchandiseListControl control)
        //{
        //    var handles = control.grvMerchandise.GetSelectedRows();
        //    var selectedItems = Enumerable.Select(handles, f => control.grvMerchandise.GetRow(f) as MerchandiseDTO);
        //    return selectedItems;

        //}
    }
}
